package com.ai.controller.made;


import com.ai.annotation.EnterPathParamLog;
import com.ai.common.CommonResponse;
import com.ai.entity.alarm.RecordAlarmBO;
import com.ai.entity.alarm.RecordAlarmPage;
import com.ai.service.made.RecordAlarmService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

/**
 * 算法识别记录
 * @author Mr.Chen
 * @since 2020-06-19
 */
@RestController
@RequestMapping("/recordAlarm")
@Slf4j
public class RecordAlarmController {

    @Resource
    RecordAlarmService recordAlarmService;


    @ApiOperation("分页查询")
    @PostMapping("list")
    @EnterPathParamLog
    public CommonResponse selectByPage(@RequestBody RecordAlarmPage page) {
        CommonResponse resultData = recordAlarmService.selectByPage(page);
        return resultData;
    }



    @ApiOperation("查询id指定带钢号的缺陷详细信息")
    @PostMapping("/defectParam/{id}")
    @EnterPathParamLog
    public CommonResponse selectDefectParamByStripNo(@PathVariable("id") Integer id) {
        CommonResponse resultData = recordAlarmService.selectDefectParamById(id);
        return resultData;
    }

    @ApiOperation("首页获取当前最新的端面告警数据")
    @PostMapping("/getUpToDateAlarm")
    @EnterPathParamLog
    public CommonResponse getUpToDateAlarm() {
        CommonResponse resultData = recordAlarmService.getUpToDateAlarm();
        return resultData;
    }

    @ApiOperation("首页获取当前最新的塔型告警数据")
    @PostMapping("/getUpToDateTXAlarm")
    @EnterPathParamLog
    public CommonResponse getUpToDateTXAlarm() {
        CommonResponse resultData = recordAlarmService.getUpToDateTXAlarm();
        return resultData;
    }

    /**
     * 标记是否误报
     *
     * @param recordAlarmBO
     * @return
     */
    @ApiOperation("标记是否误报")
    @PostMapping("signError")
    @EnterPathParamLog
    public CommonResponse signError(@RequestBody RecordAlarmBO recordAlarmBO) {
        CommonResponse resultData = recordAlarmService.signError(recordAlarmBO);
        return resultData;
    }

    @ApiOperation("获取最新的10条识别记录")
    @PostMapping("latestRecord")
    @EnterPathParamLog
    public CommonResponse latestRecord(){
        return recordAlarmService.latestRecord();
    }


}

